# coding:utf-8
import os
basedir = os.path.abspath(os.path.dirname(__file__))

class Config(object):
    SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True
    FLASKY_MAIL_SUBJECT_PREFIX = '[Flasky]'
    FLASKY_MAIL_SENDER = '879651072@qq.com'
    FLASKY_ADMIN = os.environ.get('FLASKY_ADMIN')

    @staticmethod
    def init_app(app):
        pass

class testConfig(Config):
    REDIS_HOST='localhost'
    REDIS_PORT=6379
    REDIS_DB=4
    REDIS_PASSWORD='admin'
    QINIU_ACCESS_KEY='-r-Aj9p0_r7sf-FwTAzI6Z2E_aUbWAGmz4_ppePL'
    QINIU_SECRET_KEY='QinKkVjOKlWxIm1R1SLguK_YElerr4rJdy_XIThG'
    BUCKET_NAME='oliver'
    DEBUG=True


class DevelopmentConfig(Config):
    REDIS_HOST = 'localhost'
    REDIS_PORT = 6379
    REDIS_DB = 4
    REDIS_PASSWORD = 'admin'
    QINIU_ACCESS_KEY = '-r-Aj9p0_r7sf-FwTAzI6Z2E_aUbWAGmz4_ppePL'
    QINIU_SECRET_KEY = 'QinKkVjOKlWxIm1R1SLguK_YElerr4rJdy_XIThG'
    BUCKET_NAME = 'oliver'
    DEBUG = True


class TestingConfig(Config):
    TESTING = True
    SQLALCHEMY_DATABASE_URI = os.environ.get('TEST_DATABASE_URI') or \
                              'sqlite:///' + os.path.join(basedir, 'data-test.sqlite')


class ProductionConfig(Config):
    SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URI') or \
                              'sqlite:///' + os.path.join(basedir, 'data.sqlite')

config={
        'development':DevelopmentConfig,
        'testing':TestingConfig,
        'Production':ProductionConfig,
        'default':DevelopmentConfig
        }